package be.obia.moo.dovebird;

import java.io.IOException;
import java.io.OutputStream;

import android.os.AsyncTask;

public class TCPLineSend extends AsyncTask<TCPLine, Void, Boolean> {

	@Override
	protected Boolean doInBackground(TCPLine... params) {
		String text = params[0].Line;
		if(params[0].Client.socket.isConnected()) {
			try {
				OutputStream os = params[0].Client.socket.getOutputStream();
				text += "\n";			
				os.write(text.getBytes());
				return true;
			} catch (IOException e) {
				e.printStackTrace();
				return false;
			}
		} else {
			return false;
		}
	}
}